<?php
/*
 * Copyright (c) 2009 Lukasz Sarzynski [ http://lukasz.sarzynski.biz ]
 * Writing in company codearts [ http://codearts.pl ]
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @author     Lukasz Sarzynski <LukaszSarzynski@gmail.com>
 *
 */
class BaseCaPropelTreeComponents extends sfComponents {

  public function executeRenderTree( ) {
    $this->getUser()->setAttribute('sPropelTreeCulture', sfConfig::get('sf_default_culture'));
    
    $sModelName = sfConfig::get('app_caPropelTreePlugin_sModelNameclass');
    $peer = sprintf('%sPeer', sfConfig::get('app_caPropelTreePlugin_sModelNameclass'));
    $this->oRoot = call_user_func(array($peer, 'retrieveRoot'));
    if(!$this->oRoot)
    {
      //if root not isset make it
      $this->oRoot = new $sModelName();
      $this->oRoot->makeRoot();
      $this->oRoot->save();
    }

  }

}